﻿CREATE TABLE [dbo].[PRODUCTO](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Codigo] [nvarchar](20) NOT NULL,
	[Nombre] [nvarchar](250) NOT NULL,
	[Costo] [decimal](18, 2) NOT NULL,
	[Stock] [int] NOT NULL,
	[Activo] [bit] NOT NULL,
	[IdUnidadMedida] [int] NOT NULL,
 CONSTRAINT [PK_dbo.PRODUCTO] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  ForeignKey [FK_dbo.PRODUCTO_dbo.UNIDAD_MEDIDA_IdUnidadMedida]    Script Date: 11/17/2014 00:41:42 ******/
ALTER TABLE [dbo].[PRODUCTO]  WITH NOCHECK ADD  CONSTRAINT [FK_dbo.PRODUCTO_dbo.UNIDAD_MEDIDA_IdUnidadMedida] FOREIGN KEY([IdUnidadMedida])
REFERENCES [dbo].[UNIDAD_MEDIDA] ([ID])
GO

ALTER TABLE [dbo].[PRODUCTO] CHECK CONSTRAINT [FK_dbo.PRODUCTO_dbo.UNIDAD_MEDIDA_IdUnidadMedida]
GO
CREATE NONCLUSTERED INDEX [IX_IdUnidadMedida] ON [dbo].[PRODUCTO] 
(
	[IdUnidadMedida] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]